Location: BondGraph Basic @ ad409f2f59f9 / BG Tutorial Mechanical Systems / FEM Pendulum - flexible.cellml

Author:
Soroush Safaei <ssaf006@aucklanduni.ac.nz>
Date:
2018-06-17 16:16:13+12:00
Desc:
adding pkpd model
Permanent Source URI:
https://models.fieldml.org/workspace/43b/rawfile/ad409f2f59f990318c5f24e9345405bb73d0f71b/BG Tutorial Mechanical Systems/FEM Pendulum - flexible.cellml

<?xml version='1.0'?>
<model name="my_model" xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cellml="http://www.cellml.org/cellml/1.1#">
    <!-- Multibody problem: FE solution of driven mass on rail with single pin jointed flexible pendulum-->
    <units name="per_s">
        <unit exponent="-1" units="second"/>
    </units>
    <units name="m_per_s">
        <unit units="metre"/>
        <unit exponent="-1" units="second"/>
    </units>
    <units name="m_per_s2">
        <unit units="metre"/>
        <unit exponent="-2" units="second"/>
    </units>
    <units name="rad_per_s">
        <unit units="radian"/>
        <unit exponent="-1" units="second"/>
    </units>
    <units name="rad_per_s2">
        <unit units="radian"/>
        <unit exponent="-2" units="second"/>
    </units>
    <units name="Jm">
        <unit units="joule"/>
        <unit units="metre"/>
    </units>
    <units name="Js_per_m">
        <unit units="joule"/>
        <unit units="second"/>
        <unit exponent="-1" units="metre"/>
    </units>
    <units name="Js_per_m2">
        <unit units="joule"/>
        <unit units="second"/>
        <unit exponent="-2" units="metre"/>
    </units>
    <units name="Js2_per_m3">
        <unit units="joule"/>
        <unit exponent="2" units="second"/>
        <unit exponent="-3" units="metre"/>
    </units>
    <units name="Js2_per_m2">
        <unit units="joule"/>
        <unit exponent="2" units="second"/>
        <unit exponent="-2" units="metre"/>
    </units>
    <units name="J_per_m">
        <unit units="joule"/>
        <unit exponent="-1" units="metre"/>
    </units>
    <units name="Js2_per_rad">
        <unit units="joule"/>
        <unit exponent="2" units="second"/>
        <unit exponent="-1" units="radian"/>
    </units>
    <component name="main">
        <variable initial_value="0" name="t" units="second"/>
        <variable initial_value="3.141592" name="PI" units="dimensionless"/>
        <variable name="theta_AB" units="dimensionless"/>
        <variable name="theta1_AB" units="dimensionless"/>
        <variable name="theta2_AB" units="dimensionless"/>
        <variable name="costheta_AB" units="dimensionless"/>
        <variable name="sintheta_AB" units="dimensionless"/>
        <variable initial_value="9.81" name="g" units="m_per_s2"/>
        <variable initial_value="1" name="l_AB_0" units="metre"/>
        <variable name="l_AB" units="metre"/>
        <variable initial_value="10000" name="E" units="J_per_m"/>
        <variable initial_value="10" name="R_truss" units="Js_per_m"/>
        <variable initial_value="1" name="R_beam" units="Js_per_m2"/>
        <variable name="strain_AB" units="dimensionless"/>
        <variable name="strain_rate_AB" units="per_s"/>
        <variable initial_value="1" name="m_A" units="Js2_per_m2"/>
        <variable initial_value="1" name="m_B" units="Js2_per_m2"/>
        <variable initial_value="0" name="F_A" units="J_per_m"/>
        <variable name="u_A_1" units="J_per_m"/>
        <variable name="u_A_2" units="J_per_m"/>
        <variable name="u_truss_AB" units="J_per_m"/>
        <variable name="u_beam_AB" units="J_per_m"/>
        <variable initial_value="0" name="v_A_1" units="m_per_s"/>
        <variable initial_value="0" name="v_A_2" units="m_per_s"/>
        <variable initial_value="0" name="v_B_1" units="m_per_s"/>
        <variable initial_value="0" name="v_B_2" units="m_per_s"/>
        <variable name="x_AB" units="metre"/>
        <variable name="y_AB" units="metre"/>
        <variable initial_value="0" name="q_A_1" units="metre"/>
        <variable initial_value="0" name="q_A_2" units="metre"/>
        <variable initial_value="0.707106781" name="q_B_1" units="metre"/>
        <variable initial_value="0.707106781" name="q_B_2" units="metre"/>
        <variable name="y_beam_AB_1" units="metre"/>
        <variable initial_value="0.1" name="y_beam_AB_1_ampl" units="metre"/>
        <variable name="y_beam_AB_2" units="metre"/>
        <variable initial_value="0.1" name="y_beam_AB_2_ampl" units="metre"/>
        <variable name="y_beam_AB_3" units="metre"/>
        <variable initial_value="0.1" name="y_beam_AB_3_ampl" units="metre"/>
        <variable initial_value="0" name="v_beam_AB" units="m_per_s"/>
        <variable initial_value="0.03" name="EI" units="Jm"/>
        <variable initial_value="1" name="rho" units="Js2_per_m3"/>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
                <eq/>
                <ci>x_AB</ci>
                <apply>
                    <minus/>
                    <ci>q_B_1</ci>
                    <ci>q_A_1</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>y_AB</ci>
                <apply>
                    <minus/>
                    <ci>q_B_2</ci>
                    <ci>q_A_2</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>l_AB</ci>
                <apply>
                    <root/>
                    <apply>
                        <plus/>
                        <apply>
                            <power/>
                            <ci>x_AB</ci>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                        <apply>
                            <power/>
                            <ci>y_AB</ci>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>costheta_AB</ci>
                <apply>
                    <divide/>
                    <ci>x_AB</ci>
                    <ci>l_AB</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>sintheta_AB</ci>
                <apply>
                    <divide/>
                    <ci>y_AB</ci>
                    <ci>l_AB</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>strain_AB</ci>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <ci>l_AB</ci>
                        <ci>l_AB_0</ci>
                    </apply>
                    <ci>l_AB_0</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>strain_rate_AB</ci>
                <apply>
                    <divide/>
                    <apply>
                        <plus/>
                        <apply>
                            <times/>
                            <ci>x_AB</ci>
                            <apply>
                                <minus/>
                                <ci>v_B_1</ci>
                                <ci>v_A_1</ci>
                            </apply>
                        </apply>
                        <apply>
                            <times/>
                            <ci>y_AB</ci>
                            <apply>
                                <minus/>
                                <ci>v_B_2</ci>
                                <ci>v_A_2</ci>
                            </apply>
                        </apply>
                    </apply>
                    <apply>
                        <times/>
                        <ci>l_AB</ci>
                        <ci>l_AB_0</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_truss_AB</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>E</ci>
                        <ci>strain_AB</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>R_truss</ci>
                        <ci>strain_rate_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_A_1</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>u_truss_AB</ci>
                        <ci>costheta_AB</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>u_beam_AB</ci>
                        <ci>sintheta_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_A_2</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>u_truss_AB</ci>
                        <ci>sintheta_AB</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>u_beam_AB</ci>
                        <ci>costheta_AB</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>y_beam_AB_1</ci>
                <apply>
                    <times/>
                    <ci>y_beam_AB_1_ampl</ci>
                    <apply>
                        <sin/>
                        <apply>
                            <times/>
                            <apply>
                                <root/>
                                <apply>
                                    <divide/>
                                    <ci>EI</ci>
                                    <ci>rho</ci>
                                </apply>
                            </apply>
                            <apply>
                                <power/>
                                <apply>
                                    <divide/>
                                    <ci>PI</ci>
                                    <ci>l_AB</ci>
                                </apply>
                                <cn cellml:units="dimensionless">2</cn>
                            </apply>
                            <ci>t</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>y_beam_AB_2</ci>
                <apply>
                    <times/>
                    <ci>y_beam_AB_2_ampl</ci>
                    <apply>
                        <sin/>
                        <apply>
                            <times/>
                            <apply>
                                <root/>
                                <apply>
                                    <divide/>
                                    <ci>EI</ci>
                                    <ci>rho</ci>
                                </apply>
                            </apply>
                            <apply>
                                <power/>
                                <apply>
                                    <divide/>
                                    <apply>
                                        <times/>
                                        <cn cellml:units="dimensionless">2</cn>
                                        <ci>PI</ci>
                                    </apply>
                                    <ci>l_AB</ci>
                                </apply>
                                <cn cellml:units="dimensionless">2</cn>
                            </apply>
                            <ci>t</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>y_beam_AB_3</ci>
                <apply>
                    <times/>
                    <ci>y_beam_AB_3_ampl</ci>
                    <apply>
                        <sin/>
                        <apply>
                            <times/>
                            <apply>
                                <root/>
                                <apply>
                                    <divide/>
                                    <ci>EI</ci>
                                    <ci>rho</ci>
                                </apply>
                            </apply>
                            <apply>
                                <power/>
                                <apply>
                                    <divide/>
                                    <apply>
                                        <times/>
                                        <cn cellml:units="dimensionless">3</cn>
                                        <ci>PI</ci>
                                    </apply>
                                    <ci>l_AB</ci>
                                </apply>
                                <cn cellml:units="dimensionless">2</cn>
                            </apply>
                            <ci>t</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u_beam_AB</ci>
                <apply>
                    <plus/>
                    <apply>
                        <times/>
                        <ci>EI</ci>
                        <apply>
                            <power/>
                            <apply>
                                <divide/>
                                <ci>PI</ci>
                                <ci>l_AB</ci>
                            </apply>
                            <cn cellml:units="dimensionless">3</cn>
                        </apply>
                        <ci>y_beam_AB_1</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>EI</ci>
                        <apply>
                            <power/>
                            <apply>
                                <divide/>
                                <apply>
                                    <times/>
                                    <cn cellml:units="dimensionless">2</cn>
                                    <ci>PI</ci>
                                </apply>
                                <ci>l_AB</ci>
                            </apply>
                            <cn cellml:units="dimensionless">3</cn>
                        </apply>
                        <ci>y_beam_AB_2</ci>
                    </apply>
                    <apply>
                        <times/>
                        <ci>EI</ci>
                        <apply>
                            <power/>
                            <apply>
                                <divide/>
                                <apply>
                                    <times/>
                                    <cn cellml:units="dimensionless">3</cn>
                                    <ci>PI</ci>
                                </apply>
                                <ci>l_AB</ci>
                            </apply>
                            <cn cellml:units="dimensionless">3</cn>
                        </apply>
                        <ci>y_beam_AB_3</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_A_1</ci>
                </apply>
                <apply>
                    <divide/>
                    <apply>
                        <plus/>
                        <ci>F_A</ci>
                        <ci>u_A_1</ci>
                    </apply>
                    <ci>m_A</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_B_1</ci>
                </apply>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <ci>u_A_1</ci>
                    </apply>
                    <ci>m_B</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v_B_2</ci>
                </apply>
                <apply>
                    <minus/>
                    <apply>
                        <divide/>
                        <apply>
                            <minus/>
                            <ci>u_A_2</ci>
                        </apply>
                        <ci>m_B</ci>
                    </apply>
                    <ci>g</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_A_1</ci>
                </apply>
                <ci>v_A_1</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_A_2</ci>
                </apply>
                <ci>v_A_2</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_B_1</ci>
                </apply>
                <ci>v_B_1</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_B_2</ci>
                </apply>
                <ci>v_B_2</ci>
            </apply>
            <apply>
                <eq/>
                <ci>theta1_AB</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <apply>
                            <arccos/>
                            <ci>costheta_AB</ci>
                        </apply>
                        <cn cellml:units="dimensionless">180</cn>
                    </apply>
                    <ci>PI</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>theta2_AB</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <apply>
                            <arcsin/>
                            <ci>sintheta_AB</ci>
                        </apply>
                        <cn cellml:units="dimensionless">180</cn>
                    </apply>
                    <ci>PI</ci>
                </apply>
            </apply>
            <apply id="theta_calculation">
                <eq/>
                <ci>theta_AB</ci>
                <piecewise>
                    <piece>
                        <ci>theta1_AB</ci>
                        <apply>
                            <and/>
                            <apply>
                                <gt/>
                                <ci>x_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                            <apply>
                                <gt/>
                                <ci>y_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                        </apply>
                    </piece>
                    <piece>
                        <apply>
                            <minus/>
                            <ci>theta1_AB</ci>
                        </apply>
                        <apply>
                            <and/>
                            <apply>
                                <gt/>
                                <ci>x_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                            <apply>
                                <lt/>
                                <ci>y_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                        </apply>
                    </piece>
                    <piece>
                        <apply>
                            <minus/>
                            <ci>theta1_AB</ci>
                        </apply>
                        <apply>
                            <and/>
                            <apply>
                                <lt/>
                                <ci>x_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                            <apply>
                                <lt/>
                                <ci>y_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                        </apply>
                    </piece>
                    <piece>
                        <apply>
                            <minus/>
                            <ci>theta1_AB</ci>
                            <cn cellml:units="dimensionless">360</cn>
                        </apply>
                        <apply>
                            <and/>
                            <apply>
                                <lt/>
                                <ci>x_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                            <apply>
                                <gt/>
                                <ci>y_AB</ci>
                                <cn cellml:units="metre">0</cn>
                            </apply>
                        </apply>
                    </piece>
                </piecewise>
            </apply>
        </math>
    </component>
</model>